<?php
class Master_instansi extends CI_Model 
{

	function __construct()
	{
		parent::__construct();
	}
	
	function read()
	{
		$this->db->select('*');
		$this->db->from('m_instansi');
		$this ->db->order_by('instansi');

		$query = $this->db->get();		
		return $query->result();
	}

	function save($dataInsert)
	{
		$query = $this->db->insert('m_instansi', $dataInsert);
		return $query;
	}

	function edit($id_m_instansi)
	{
		$this->db->where('id_m_instansi',$id_m_instansi);
		$query=$this->db->get('m_instansi');
		return $query->result();
	}
	
	function update($id_m_instansi,$dataInsert)
	{
		$this->db->where('id_m_instansi', $id_m_instansi);
		$update = $this->db->update('m_instansi', $dataInsert);
		return $update;
	}	
	
	function delete($id_m_instansi)
	{
		$this->db->where('id_m_instansi', $id_m_instansi);
		$delete = $this->db->delete('m_instansi');
		return $delete;
	}

}